package com.prs.crm.domain.sys;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Embedded;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.BaseEntity;

/**
 * 自定义属性UI显示
 * @author prs.chenzhi
 *
 */
@Entity
@Table(name="sys_fieldui")
public class FieldUI extends BaseEntity{
	
	private static final long serialVersionUID = 1L;
	
	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	
	private Integer uiType;
	
	/**
	 * 验证器
	 */
	@ManyToMany
	private Set<Validator> validators;
	
	@Embedded
	private FieldUIEvent event;
	
	@Embedded
	private FieldUIProperty property;
	
	@ManyToOne
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private FieldChoose chooseItem;

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return id;
	}

	public void setUiType(Integer uiType) {
		this.uiType = uiType;
	}

	public Integer getUiType() {
		return uiType;
	}

	public void setChooseItem(FieldChoose chooseItem) {
		this.chooseItem = chooseItem;
	}

	public FieldChoose getChooseItem() {
		return chooseItem;
	}

	public void setValidators(Set<Validator> validators) {
		this.validators = validators;
	}

	public Set<Validator> getValidators() {
		return validators;
	}
}
